<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>统计</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
    <link th:href="@{/ajax/libs/datapicker/bootstrap-datetimepicker.min.css?v=2.4.4}" rel="stylesheet"/>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">
    <input type="hidden" id="exchangeStartTime" th:value="${exchangeStartTime}">
    <input type="hidden" id="exchangeEndTime" th:value="${exchangeEndTime}">
    <div class="row">
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>汽油92#销售额</h2>
                    <div class="form-group">
                        <label class="font-noraml">统计区间</label>
                        <div class="input-daterange input-group">
                            <input type="text" class="input-sm form-control" id="laydate-startTime92"
                                   placeholder="开始时间"/>
                            <span class="input-group-addon">-</span>
                            <input type="text" class="input-sm form-control" id="laydate-endTime92" placeholder="结束时间"/>
                        </div>
                        <a class="btn btn-warning btn-xs" href="#" onclick="showDetail(1)"><i class="fa fa-search">区间明细</i></a>
                    </div>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                微信支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayTotal92" th:text="${wxPayTotal92}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                余额支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="balancePayTotal92" th:text="${balancePayTotal92}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                线下支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="offlinePayTotal92" th:text="${offlinePayTotal92}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计销售金额(不计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="orderCostTotal92" th:text="${orderCostTotal92}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计实付金额(计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="payCostTotal92" th:text="${payCostTotal92}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计数量：
                            </td>
                            <td class="no-borders">
                                <b id="quantityTotal92" th:text="${quantityTotal92}"></b>（升）
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>汽油95#销售额</h2>
                    <div class="form-group">
                        <label class="font-noraml">统计区间</label>
                        <div class="input-daterange input-group">
                            <input type="text" class="input-sm form-control" id="laydate-startTime95"
                                   placeholder="开始时间"/>
                            <span class="input-group-addon">-</span>
                            <input type="text" class="input-sm form-control" id="laydate-endTime95" placeholder="结束时间"/>
                        </div>
                        <a class="btn btn-warning btn-xs" href="#" onclick="showDetail(2)"><i class="fa fa-search">区间明细</i></a>
                    </div>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                微信支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayTotal95" th:text="${wxPayTotal95}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                余额支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="balancePayTotal95" th:text="${balancePayTotal95}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                线下支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="offlinePayTotal95" th:text="${offlinePayTotal95}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计销售金额(不计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="orderCostTotal95" th:text="${orderCostTotal95}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计实付金额(计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="payCostTotal95" th:text="${payCostTotal95}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计数量：
                            </td>
                            <td class="no-borders">
                                <b id="quantityTotal95" th:text="${quantityTotal95}"></b>（升）
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>柴油0#销售额</h2>
                    <div class="form-group">
                        <label class="font-noraml">统计区间</label>
                        <div class="input-daterange input-group">
                            <input type="text" class="input-sm form-control" id="laydate-startTime0"
                                   placeholder="开始时间"/>
                            <span class="input-group-addon">-</span>
                            <input type="text" class="input-sm form-control" id="laydate-endTime0" placeholder="结束时间"/>
                        </div>
                        <a class="btn btn-warning btn-xs" href="#" onclick="showDetail(3)"><i class="fa fa-search">区间明细</i></a>
                    </div>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                微信支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayTotal0" th:text="${wxPayTotal0}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                余额支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="balancePayTotal0" th:text="${balancePayTotal0}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                线下支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="offlinePayTotal0" th:text="${offlinePayTotal0}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计销售金额(不计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="orderCostTotal0" th:text="${orderCostTotal0}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计实付金额(计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="payCostTotal0" th:text="${payCostTotal0}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计数量：
                            </td>
                            <td class="no-borders">
                                <b id="quantityTotal0" th:text="${quantityTotal0}"></b>（升）
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>柴油-10#销售额</h2>
                    <div class="form-group">
                        <label class="font-noraml">统计区间</label>
                        <div class="input-daterange input-group">
                            <input type="text" class="input-sm form-control" id="laydate-startTime10"
                                   placeholder="开始时间"/>
                            <span class="input-group-addon">-</span>
                            <input type="text" class="input-sm form-control" id="laydate-endTime10" placeholder="结束时间"/>
                        </div>
                        <a class="btn btn-warning btn-xs" href="#" onclick="showDetail(13)"><i class="fa fa-search">区间明细</i></a>
                    </div>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                微信支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayTotal10" th:text="${wxPayTotal10}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                余额支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="balancePayTotal10" th:text="${balancePayTotal10}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                线下支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="offlinePayTotal10" th:text="${offlinePayTotal10}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计销售金额(不计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="orderCostTotal10" th:text="${orderCostTotal10}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计实付金额(计算优惠)：
                            </td>
                            <td class="no-borders">
                                <b id="payCostTotal10" th:text="${payCostTotal10}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                累计数量：
                            </td>
                            <td class="no-borders">
                                <b id="quantityTotal10" th:text="${quantityTotal10}"></b>（升）
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>充值及余额统计</h2>
                    <div class="form-group">
                        <label class="font-noraml">统计区间</label>
                        <div class="input-daterange input-group">
                            <input type="text" class="input-sm form-control" id="laydate-startTimeA"
                                   placeholder="开始时间"/>
                            <span class="input-group-addon">-</span>
                            <input type="text" class="input-sm form-control" id="laydate-endTimeA" placeholder="结束时间"/>
                        </div>
                        <a class="btn btn-warning btn-xs" href="#" onclick="showDetail(9901)"><i class="fa fa-search">区间明细</i></a>
                    </div>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                充值合计：
                            </td>
                            <td class="no-borders">
                                <b id="rechargePayTotal" th:text="${rechargePayTotal}"></b>（元）
                            </td>
                        </tr>
                    </table>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                <span>会员充值累计：</span><br><span th:text="${'(截止-'+nowTime+')'}"></span>
                            </td>
                            <td class="no-borders">
                                <b id="allRechargeTotal" th:text="${allRechargeTotal}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                <span>赠送余额累计：</span><br><span th:text="${'(截止-'+nowTime+')'}"></span>
                            </td>
                            <td class="no-borders">
                                <b id="allRechargeGiftAmountTotal" th:text="${allRechargeGiftAmountTotal}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                <span>后台余额调整累计：</span><br><span th:text="${'(截止-'+nowTime+')'}"></span>
                            </td>
                            <td class="no-borders">
                                <b id="allBackRechargeBalanceTotal" th:text="${allBackRechargeBalanceTotal}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                <span>会员余额累计：</span><br><span th:text="${'(截止-'+nowTime+')'}"></span>
                            </td>
                            <td class="no-borders">
                                <b id="allBalanceTotal" th:text="${allBalanceTotal}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>
                                <span>会员余额支付累计：</span><br><span th:text="${'(截止-'+nowTime+')'}"></span>
                            </td>
                            <td class="no-borders">
                                <b id="allBalancePayTotal" th:text="${allBalancePayTotal}"></b>（元）
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>每日交班统计</h2>
                    <div class="form-group">
                        <label class="font-noraml">统计区间</label>
                        <div class="input-daterange input-group">
                            <input type="text" class="input-sm form-control" id="laydate-startTimeB"
                                   placeholder="开始时间"/>
                            <span class="input-group-addon">-</span>
                            <input type="text" class="input-sm form-control" id="laydate-endTimeB" placeholder="结束时间"/>
                        </div>
                    </div>
                    <table class="table table-stripped m-t-md">
                        <tbody>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>新充值金额：
                            </td>
                            <td class="no-borders">
                                <b id="rechargePayTotalB" th:text="${rechargePayTotalB}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>剩余余额合计：
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>截止-<span id="balanceTotalEndTime" th:text="${exchangeEndTime}"></span></span>
                            </td>
                            <td class="no-borders">
                                <b id="balanceTotalB" th:text="${balanceTotalB}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>余额加油钱数(优惠后):
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>区间内用余额支付的实付金额</span>
                            </td>
                            <td class="no-borders">
                                <b id="balancePetrolTotalB" th:text="${balancePetrolTotalB}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>优惠钱数：
                            </td>
                            <td class="no-borders">
                                <b id="discountTotalB" th:text="${discountTotalB}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>余额加油钱数(优惠前)：
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>区间内用余额支付的订单金额</span>
                            </td>
                            <td class="no-borders">
                                <b id="balancePetrolNoDiscountB" th:text="${balancePetrolNoDiscountB}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>汽油小程序微信支付：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayPetrolTotalB1" th:text="${wxPayPetrolTotalB1}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>柴油小程序微信支付：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayPetrolTotalB2" th:text="${wxPayPetrolTotalB2}"></b>（元）
                            </td>
                        </tr>
                        <tr>
                            <td class="no-borders">
                                <i class="fa fa-circle text-navy"></i>小程序微信支付合计：
                            </td>
                            <td class="no-borders">
                                <b id="wxPayPetrolTotalB" th:text="${wxPayPetrolTotalB}"></b>（元）
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/js/jquery.min.js?v=3.6.0}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js?v=3.5.1}"></script>
<script th:src="@{/ajax/libs/layui/layui.min.js?v=2.6.8}"></script>
<script th:src="@{/ajax/libs/datapicker/bootstrap-datetimepicker.min.js?v=2.4.4}"></script>

<script th:inline="javascript">
    var ctx = [[@{/}]];
        $(function () {
            layui.use('laydate', function () {
                var laydate = layui.laydate;
                var startDate92 = laydate.render({
                    elem: '#laydate-startTime92',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(0),
                    done: function (value, date) {
                        // 结束时间大于开始时间
                        if (value !== '') {
                            if ($('#laydate-endTime92').val() !== '') {
                                getStatistics(1, value, $('#laydate-endTime92').val());
                            }
                        }
                    }
                });

                var endDate92 = laydate.render({
                    elem: '#laydate-endTime92',
                    theme: 'molv',
                    type: 'datetime',
                    value: getDefaultTime(1),
                    trigger: 'click',
                    done: function (value, date) {
                        // 开始时间小于结束时间
                        if (value !== '') {
                            if ($('#laydate-startTime92').val() !== '') {
                                getStatistics(1, $('#laydate-startTime92').val(), value);
                            }
                        }
                    }
                });

                var startDate95 = laydate.render({
                    elem: '#laydate-startTime95',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(0),
                    done: function (value, date) {
                        // 结束时间大于开始时间
                        if (value !== '') {
                            if ($('#laydate-endTime95').val() !== '') {
                                getStatistics(2, value, $('#laydate-endTime95').val());
                            }
                        }
                    }
                });

                var endDate95 = laydate.render({
                    elem: '#laydate-endTime95',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(1),
                    done: function (value, date) {
                        if (value !== '') {
                            if ($('#laydate-startTime95').val() !== '') {
                                getStatistics(2, $('#laydate-startTime95').val(), value);
                            }
                        }
                    }
                });

                var startDate0 = laydate.render({
                    elem: '#laydate-startTime0',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(0),
                    done: function (value, date) {
                        // // 结束时间大于开始时间
                        if (value !== '') {
                            if ($('#laydate-endTime0').val() !== '') {
                                getStatistics(3, value, $('#laydate-endTime0').val());
                            }
                        }
                    }
                });

                var endDate0 = laydate.render({
                    elem: '#laydate-endTime0',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(1),
                    done: function (value, date) {
                        // 开始时间小于结束时间
                        if (value !== '') {
                            if ($('#laydate-startTime0').val() !== '') {
                                getStatistics(3, $('#laydate-startTime0').val(), value);
                            }
                        }
                    }
                });
                var startDate10 = laydate.render({
                    elem: '#laydate-startTime10',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(0),
                    done: function (value, date) {
                        // // 结束时间大于开始时间
                        if (value !== '') {
                            if ($('#laydate-endTime10').val() !== '') {
                                getStatistics(13, value, $('#laydate-endTime10').val());
                            }
                        }
                    }
                });

                var endDate10 = laydate.render({
                    elem: '#laydate-endTime10',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(1),
                    done: function (value, date) {
                        // 开始时间小于结束时间
                        if (value !== '') {
                            if ($('#laydate-startTime10').val() !== '') {
                                getStatistics(13, $('#laydate-startTime10').val(), value);
                            }
                        }
                    }
                });
                var startDateA = laydate.render({
                    elem: '#laydate-startTimeA',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(0),
                    done: function (value, date) {
                        // // 结束时间大于开始时间
                        if (value !== '') {
                            if ($('#laydate-endTimeA').val() !== '') {
                                getStatistics(9901, value, $('#laydate-endTimeA').val());
                            }
                        }
                    }
                });

                var endDateA = laydate.render({
                    elem: '#laydate-endTimeA',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value: getDefaultTime(1),
                    done: function (value, date) {
                        // 开始时间小于结束时间
                        if (value !== '') {
                            if ($('#laydate-startTimeA').val() !== '') {
                                getStatistics(9901, $('#laydate-startTimeA').val(), value);
                            }
                        }
                    }
                });

                var startDateB = laydate.render({
                    elem: '#laydate-startTimeB',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value:  $('#exchangeStartTime').val(),
                    done: function (value, date) {
                        // // 结束时间大于开始时间
                        if (value !== '') {
                            if ($('#laydate-endTimeB').val() !== '') {
                                getStatistics(9902, value, $('#laydate-endTimeB').val());
                            }
                        }
                    }
                });

                var endDateB = laydate.render({
                    elem: '#laydate-endTimeB',
                    theme: 'molv',
                    type: 'datetime',
                    trigger: 'click',
                    value:  $('#exchangeEndTime').val(),
                    done: function (value, date) {
                        // 开始时间小于结束时间
                        if (value !== '') {
                            if ($('#laydate-startTimeB').val() !== '') {
                                getStatistics(9902, $('#laydate-startTimeB').val(), value);
                                $('#balanceTotalEndTime').text(value);
                            }
                        }
                    }
                });
            });
        });

    /**获取默认时间*/
    function getDefaultTime(type) {
        var today = new Date();
        var targetday_milliseconds = today.getTime();
        today.setTime(targetday_milliseconds);
        var tYear = today.getFullYear();
        var tMonth = today.getMonth();
        var tDate = today.getDate();
        tMonth = doHandleMonth(tMonth + 1);
        tDate = doHandleMonth(tDate);
        return tYear + "-" + tMonth + "-" + tDate + (0 == type ? " 00:00:00" : " 23:59:59");
    }

    function doHandleMonth(month) {
        var m = month;
        if (month.toString().length == 1) {
            m = "0" + month;
        }
        return m;
    }

    function getStatistics(productId, startTime, endTime) {
        $.ajax({
            type: 'post',
            url: ctx + "getStatistics",
            data: {productId: productId, startTime: startTime, endTime: endTime},
            dataType: 'json',
            async: true,
            success: function (result) {
                if (result.code == 0) {
                    //更新查询结果
                    switch (productId) {
                        case 1:
                            $('#wxPayTotal92').text(result.data.wxPayTotal);
                            $('#balancePayTotal92').text(result.data.balancePayTotal);
                            $('#offlinePayTotal92').text(result.data.offlinePayTotal);
                            $('#orderCostTotal92').text(result.data.orderCostTotal);
                            $('#payCostTotal92').text(result.data.payCostTotal);
                            $('#quantityTotal92').text(result.data.quantityTotal);
                            break;
                        case 2:
                            $('#wxPayTotal95').text(result.data.wxPayTotal);
                            $('#balancePayTotal95').text(result.data.balancePayTotal);
                            $('#offlinePayTotal95').text(result.data.offlinePayTotal);
                            $('#orderCostTotal95').text(result.data.orderCostTotal);
                            $('#payCostTotal95').text(result.data.payCostTotal);
                            $('#quantityTotal95').text(result.data.quantityTotal);
                            break;
                        case 13:
                            $('#wxPayTotal0').text(result.data.wxPayTotal);
                            $('#balancePayTotal0').text(result.data.balancePayTotal);
                            $('#offlinePayTotal0').text(result.data.offlinePayTotal);
                            $('#orderCostTotal0').text(result.data.orderCostTotal);
                            $('#payCostTotal0').text(result.data.payCostTotal);
                            $('#quantityTotal0').text(result.data.quantityTotal);
                            break;
                        case 4:
                            $('#wxPayTotal10').text(result.data.wxPayTotal);
                            $('#balancePayTotal10').text(result.data.balancePayTotal);
                            $('#offlinePayTotal10').text(result.data.offlinePayTotal);
                            $('#orderCostTotal10').text(result.data.orderCostTotal);
                            $('#payCostTotal10').text(result.data.payCostTotal);
                            $('#quantityTotal10').text(result.data.quantityTotal);
                            break;
                        case 9901:
                            $('#rechargePayTotal').text(result.data.rechargePayTotal);
                            break;
                        case 9902:
                            $('#rechargePayTotalB').text(result.data.rechargePayTotal);
                            $('#balanceTotalB').text(result.data.balanceTotal);
                            $('#balancePetrolTotalB').text(result.data.balancePetrolTotal);
                            $('#discountTotalB').text(result.data.discountTotal);
                            $('#balancePetrolNoDiscountB').text(result.data.balancePetrolNoDiscount);
                            $('#wxPayPetrolTotalB1').text(result.data.wxPayPetrolTotal1);
                            $('#wxPayPetrolTotalB2').text(result.data.wxPayPetrolTotal2);
                            $('#wxPayPetrolTotalB').text(result.data.wxPayPetrolTotal);
                            break;
                        default:
                            break;
                    }
                }
            }
        });
    }

    function trim(value) {
        if (value == null) {
            return "";
        }
        return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, "");
    }

    function isEmpty(value) {
        if (value == null || trim(value) == "" || value == undefined || value == "undefined") {
            return true;
        }
        return false;
    }

    function open(title, url, width, height, callback) {
        // 如果是移动端，就使用自适应大小弹窗
        if (navigator.userAgent.match(/(Android|iPhone|SymbianOS|Windows Phone|iPad|iPod)/i)) {
            width = 'auto';
            height = 'auto';
        }
        if (isEmpty(title)) {
            title = false;
        }
        if (isEmpty(url)) {
            url = "/404.html";
        }
        if (isEmpty(width)) {
            width = 1000;
        }
        if (isEmpty(height)) {
            height = ($(window).height() - 50);
        }
        if (isEmpty(callback)) {
            callback = function(index, layero) {
                var iframeWin = layero.find('iframe')[0];
                iframeWin.contentWindow.submitHandler(index, layero);
            }
        }
        layer.open({
            type: 2,
            area: [width + 'px', height + 'px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: false,
            title: title,
            content: url,
            btn: ['<i class="fa fa-close"></i> 关闭'],
            yes: function (index, layero) {
                layero.remove();
                return;
            },
            cancel: function () {
                return true;
            },
            // 弹层外区域关闭
            shadeClose: true
        });
    }

    function showDetail(productId) {
        var url = ctx + 'back/shopOrder/petrolDescList/' + productId+'/';
        var timeRange;
        switch (productId) {
            case 1:
                timeRange = $('#laydate-startTime92').val()+","+$('#laydate-endTime92').val();
                break;
            case 2:
                timeRange = $('#laydate-startTime95').val()+","+$('#laydate-endTime95').val();
                break;
            case 3:
                timeRange = $('#laydate-startTime0').val()+","+$('#laydate-endTime0').val();
                break;
            case 13:
                timeRange = $('#laydate-startTime10').val()+","+$('#laydate-endTime10').val();
                break;
            case 9901:
                timeRange = $('#laydate-startTimeA').val()+","+$('#laydate-endTimeA').val();
                open("会员充值明细", ctx + 'back/shopOrder/rechargeDescList/'+timeRange);
                return;
            case 9902:
                timeRange = $('#laydate-startTimeB').val()+","+$('#laydate-endTimeB').val();
                break;
            default:
                break;
        }
        if('' == timeRange){
            return;
        }
        open("加油订单明细", url+timeRange);
    }

</script>
</body>
</html>
